package com.cbg.discount.controller;

import com.cbg.base.core.SuperController;
import com.cbg.base.utils.Result;
import com.cbg.discount.entity.Discount;
import com.cbg.discount.mapper.DiscountMapper;
import com.cbg.discount.service.IDiscountService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/discount")
public class DiscountController extends SuperController<IDiscountService, Discount> {
    @Autowired
    DiscountMapper discountMapper;

    @ApiOperation(value="获取用户优惠券列表", notes="获取用户优惠券列表")
    @ApiImplicitParam(name = "routeId", value = "路线id", required = true, dataType = "String", paramType = "path")
    @GetMapping("/{routeId}")
    public Result<?> discountPersonal(@PathVariable String routeId){
        return Result.ok(discountMapper.discountsPersonal(routeId,userId()));
    }
}
